﻿using Newtonsoft.Json;
using PHMEE.Admin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PHMEE.MqttClient.MqttBusinessCommand
{
    /// <summary>
    /// 数采器注册业务
    /// </summary>
    public class RegisterCommand : BaseCommand
    {
        private ISysParaAppService sysParaAppService;
        public RegisterCommand(ISysParaAppService sysParaAppService)
        {
            this.sysParaAppService = sysParaAppService;
        }
        public override async Task ExecuteAsync(string requestInfo)
        {
            var createSysParaExtendDto = JsonConvert.DeserializeObject<CreateSysParaExtendDto>(requestInfo);
            if (createSysParaExtendDto != null)
            {
                await sysParaAppService.CreateSysParaExtendAndUpdateSyspara(createSysParaExtendDto);
            }
            isReplay = true;
        }
    }
}
